import reshandler from 'services/response-handler'
import Vue from 'vue'
/*
 * 动态详情
 */
function makeData(response) {
    let val = response.post
    let data = {
        author:{
            name:val.author.name,
            nickname:val.author.nickname,
            id:val.author.id,
            publishDate:val.publishDate,
            head:val.author.head,
            postType:val.postType,
            hasFollow:val.hasFollow
        },
        commentCount:val.commentCount,
        content:val.content,
        hasFollow:val.hasFollow,
        id:val.id,
        publishDate:val.publishDate,
        refId:val.refId,
        spaceType:val.spaceType,
        supportCount:val.supportCount,
        title:val.title,
        topics:val.topics || []
    }
  return data
}
export default function (params, success, fail) {
  // request 
  params = Object.assign({}, params, {
    methodName: "QueryPost",
  })

  // invoke
  this.$.get(params)
    .then(reshandler.success(success, fail, makeData), reshandler.error(fail))
}